package com.bjgov.scoresys.util;

public class Page {

	private boolean hasPrePage;

	private boolean hasNextPage;

	private int everyPage;

	private int totalPage;

	private int currentPage;

	private int beginIndex;

	public Page() {

	}

	public Page(int everyPage) {
		this.everyPage = everyPage;
	}

	/** The whole constructor */
	public Page(boolean hasPrePage, boolean hasNextPage, int everyPage,
			int totalPage, int currentPage, int beginIndex) {
		this.hasPrePage = hasPrePage;
		this.hasNextPage = hasNextPage;
		this.everyPage = everyPage;
		this.totalPage = totalPage;
		this.currentPage = currentPage;
		this.beginIndex = beginIndex;
	}

	public boolean isHasPrePage() {
		return hasPrePage;
	}

	public void setHasPrePage(boolean hasPrePage) {
		this.hasPrePage = hasPrePage;
	}

	public int getPrePage() {
		return this.currentPage-1;
	}
	
	public int getNextPage() {
		return this.currentPage+1;
	}	
	
	public boolean isHasNextPage() {
		return hasNextPage;
	}

	public void setHasNextPage(boolean hasNextPage) {
		this.hasNextPage = hasNextPage;
	}

	public int getEveryPage() {
		return everyPage;
	}

	public void setEveryPage(int everyPage) {
		this.everyPage = everyPage;
	}

	public int getCurrentPage() {
		return currentPage;
	}

	public void setCurrentPage(int currentPage) {
		this.currentPage = currentPage;
	}

	public int getBeginIndex() {
		return beginIndex;
	}

	public void setBeginIndex(int beginIndex) {
		this.beginIndex = beginIndex;
	}

	public int getTotalPage() {
		return totalPage;
	}

	public void setTotalPage(int totalPage) {
		this.totalPage = totalPage;
	}

	@Override
	public String toString() {
		StringBuilder builder = new StringBuilder();
		builder.append("Page [hasPrePage=");
		builder.append(hasPrePage);
		builder.append(", hasNextPage=");
		builder.append(hasNextPage);
		builder.append(", everyPage=");
		builder.append(everyPage);
		builder.append(", totalPage=");
		builder.append(totalPage);
		builder.append(", currentPage=");
		builder.append(currentPage);
		builder.append(", beginIndex=");
		builder.append(beginIndex);
		builder.append("]");
		return builder.toString();
	}
}
